home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QD3DSet.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  10.3 KB  |  324 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QD3DSet.h
  3.  
  4.      Contains:    Q3Set types and routines                                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DSET__
  18. #define __QD3DSET__
  19.  
  20. #ifndef __QD3D__
  21.     #include <QD3D.h>
  22. #endif
  23.  
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=power
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47. #if PRAGMA_ENUM_ALWAYSINT
  48.     #pragma enumsalwaysint on
  49. #elif PRAGMA_ENUM_OPTIONS
  50.     #pragma option enum=int
  51. #elif PRAGMA_ENUM_PACK
  52.     #if __option(pack_enums)
  53.         #define PRAGMA_ENUM_PACK__QD3DSET__
  54.     #endif
  55.     #pragma options(!pack_enums)
  56. #endif
  57.  
  58. /******************************************************************************
  59.  **                                                                             **
  60.  **                                Set Routines                                 **
  61.  **                                                                             **
  62.  *****************************************************************************/
  63. EXTERN_API_C( TQ3SetObject )
  64. Q3Set_New                        (void);
  65.  
  66. EXTERN_API_C( TQ3ObjectType )
  67. Q3Set_GetType                    (TQ3SetObject             theSet);
  68.  
  69. EXTERN_API_C( TQ3Status )
  70. Q3Set_Add                        (TQ3SetObject             theSet,
  71.                                  TQ3ElementType         theType,
  72.                                  const void *            data);
  73.  
  74. EXTERN_API_C( TQ3Status )
  75. Q3Set_Get                        (TQ3SetObject             theSet,
  76.                                  TQ3ElementType         theType,
  77.                                  void *                    data);
  78.  
  79. EXTERN_API_C( TQ3Boolean )
  80. Q3Set_Contains                    (TQ3SetObject             theSet,
  81.                                  TQ3ElementType         theType);
  82.  
  83. EXTERN_API_C( TQ3Status )
  84. Q3Set_Clear                        (TQ3SetObject             theSet,
  85.                                  TQ3ElementType         theType);
  86.  
  87. EXTERN_API_C( TQ3Status )
  88. Q3Set_Empty                        (TQ3SetObject             target);
  89.  
  90. /*
  91.  *  Iterating through all elements in a set
  92.  *
  93.  *  Pass in kQ3ElementTypeNone to get first type
  94.  *  kQ3ElementTypeNone is returned when end of list is reached
  95.  */
  96. EXTERN_API_C( TQ3Status )
  97. Q3Set_GetNextElementType        (TQ3SetObject             theSet,
  98.                                  TQ3ElementType *        theType);
  99.  
  100.  
  101. /******************************************************************************
  102.  **                                                                             **
  103.  **                                Attribute Types                                 **
  104.  **                                                                             **
  105.  *****************************************************************************/
  106. /* 
  107.  *    For the data types listed below, pass in a pointer to it in the _Add 
  108.  *    and _Get calls.
  109.  *
  110.  *    For surface shader attributes, reference counts are incremented on 
  111.  *    the _Add and _Get 
  112.  */
  113.  
  114. enum TQ3AttributeTypes {
  115.                                                                 /* Data Type                */
  116.     kQ3AttributeTypeNone        = 0,                            /* ---------                */
  117.     kQ3AttributeTypeSurfaceUV    = 1,                            /* TQ3Param2D                */
  118.     kQ3AttributeTypeShadingUV    = 2,                            /* TQ3Param2D                 */
  119.     kQ3AttributeTypeNormal        = 3,                            /* TQ3Vector3D                 */
  120.     kQ3AttributeTypeAmbientCoefficient = 4,                        /* float                     */
  121.     kQ3AttributeTypeDiffuseColor = 5,                            /* TQ3ColorRGB                */
  122.     kQ3AttributeTypeSpecularColor = 6,                            /* TQ3ColorRGB                */
  123.     kQ3AttributeTypeSpecularControl = 7,                        /* float                    */
  124.     kQ3AttributeTypeTransparencyColor = 8,                        /* TQ3ColorRGB                */
  125.     kQ3AttributeTypeSurfaceTangent = 9,                            /* TQ3Tangent2D              */
  126.     kQ3AttributeTypeHighlightState = 10,                        /* TQ3Switch                 */
  127.     kQ3AttributeTypeSurfaceShader = 11,                            /* TQ3SurfaceShaderObject    */
  128.     kQ3AttributeTypeNumTypes    = 12
  129. };
  130. typedef enum TQ3AttributeTypes TQ3AttributeTypes;
  131.  
  132. typedef TQ3ElementType                     TQ3AttributeType;
  133. /******************************************************************************
  134.  **                                                                             **
  135.  **                                Attribute Drawing                             **
  136.  **                                                                             **
  137.  *****************************************************************************/
  138. EXTERN_API_C( TQ3Status )
  139. Q3Attribute_Submit                (TQ3AttributeType         attributeType,
  140.                                  const void *            data,
  141.                                  TQ3ViewObject             view);
  142.  
  143.  
  144. /******************************************************************************
  145.  **                                                                             **
  146.  **                            AttributeSet Routines                             **
  147.  **                                                                             **
  148.  *****************************************************************************/
  149. EXTERN_API_C( TQ3AttributeSet )
  150. Q3AttributeSet_New                (void);
  151.  
  152. EXTERN_API_C( TQ3Status )
  153. Q3AttributeSet_Add                (TQ3AttributeSet         attributeSet,
  154.                                  TQ3AttributeType         theType,
  155.                                  const void *            data);
  156.  
  157. EXTERN_API_C( TQ3Boolean )
  158. Q3AttributeSet_Contains            (TQ3AttributeSet         attributeSet,
  159.                                  TQ3AttributeType         attributeType);
  160.  
  161. EXTERN_API_C( TQ3Status )
  162. Q3AttributeSet_Get                (TQ3AttributeSet         attributeSet,
  163.                                  TQ3AttributeType         theType,
  164.                                  void *                    data);
  165.  
  166. EXTERN_API_C( TQ3Status )
  167. Q3AttributeSet_Clear            (TQ3AttributeSet         attributeSet,
  168.                                  TQ3AttributeType         theType);
  169.  
  170. EXTERN_API_C( TQ3Status )
  171. Q3AttributeSet_Empty            (TQ3AttributeSet         target);
  172.  
  173. /*
  174.  * Q3AttributeSet_GetNextAttributeType
  175.  *
  176.  * Pass in kQ3AttributeTypeNone to get first type
  177.  * kQ3AttributeTypeNone is returned when end of list is reached
  178.  */
  179. EXTERN_API_C( TQ3Status )
  180. Q3AttributeSet_GetNextAttributeType (TQ3AttributeSet     source,
  181.                                  TQ3AttributeType *        theType);
  182.  
  183. EXTERN_API_C( TQ3Status )
  184. Q3AttributeSet_Submit            (TQ3AttributeSet         attributeSet,
  185.                                  TQ3ViewObject             view);
  186.  
  187. /*
  188.  * Inherit from parent->child into result
  189.  *    Result attributes are:
  190.  *        all child attributes + all parent attributes NOT in the child
  191.  */
  192. EXTERN_API_C( TQ3Status )
  193. Q3AttributeSet_Inherit            (TQ3AttributeSet         parent,
  194.                                  TQ3AttributeSet         child,
  195.                                  TQ3AttributeSet         result);
  196.  
  197.  
  198. /******************************************************************************
  199.  **                                                                             **
  200.  **                            Custom Element Registration                         **
  201.  **                                                                             **
  202.  *****************************************************************************/
  203. /*
  204.  * Element Methods - 
  205.  *
  206.  *         When you create a custom element, you control what structures are 
  207.  *        passed around the API. For example, you may allow the Q3Set_Add call 
  208.  *        take one type of argument, store your element internally in some 
  209.  *        abstract data type, and have the Q3Set_Get call take a different 
  210.  *        argument.
  211.  *
  212.  *        For example:
  213.  *            
  214.  *        There are four calls which at some point will copy an element:
  215.  *
  216.  *        Q3Set_Add (copied from Application memory to QuickDraw3D memory)
  217.  *        Q3Set_Get (copied from QuickDraw3D memory to Application memory)
  218.  *        Q3Object_Duplicate (all elements are copied internally)
  219.  *        Q3AttributeSet_Inherit (all elements are copied internally)
  220.  *
  221.  *         Either CopyAdd or CopyReplace is called during the "_Add" call.
  222.  *            - CopyAdd is destructive and should assume "toElement" is garbage
  223.  *            - CopyReplace is replacing an existing element.
  224.  *
  225.  *         CopyGet is called during the "_Get" call.
  226.  *
  227.  *         CopyDuplicate is called to duplicate an element's internal structure.
  228.  *
  229.  * Attributes Methods - 
  230.  *
  231.  *        For copying data while Inheriting. Element methods are used
  232.  *        at all other times.
  233.  *    
  234.  *         CopyInherit is called to duplicate an element's internal structure 
  235.  *            during inheritance. You should make this as fast as possible.
  236.  *            (for example, if your custom element contains objects, you
  237.  *             should do a Q3Shared_GetReference instead of a Q3Object_Duplicate)
  238.  *            
  239.  *        The ElementDelete method will be called for all of your elements 
  240.  *        copied around via CopyAdd, CopyReplace, CopyDuplicate, and 
  241.  *        CopyInherit.
  242.  *        If CopyGet allocates any memory in it's destination, it is up to the 
  243.  *        application to delete it on its side.
  244.  */
  245. #define kQ3XMethodTypeElementCopyAdd            Q3_METHOD_TYPE('e','c','p','a')
  246. #define kQ3XMethodTypeElementCopyReplace        Q3_METHOD_TYPE('e','c','p','r')
  247. #define kQ3XMethodTypeElementCopyGet            Q3_METHOD_TYPE('e','c','p','g')
  248. #define kQ3XMethodTypeElementCopyDuplicate        Q3_METHOD_TYPE('e','c','p','d')
  249. #define kQ3XMethodTypeElementDelete                Q3_METHOD_TYPE('e','d','e','l')
  250. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyAddMethod )(const void *fromAPIElement, void *toInternalElement);
  251. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyReplaceMethod )(const void *fromAPIElement, void *ontoInternalElement);
  252. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyGetMethod )(const void *fromInternalElement, void *toAPIElement);
  253. typedef CALLBACK_API_C( TQ3Status , TQ3XElementCopyDuplicateMethod )(const void *fromInternalElement, void *toInternalElement);
  254. typedef CALLBACK_API_C( TQ3Status , TQ3XElementDeleteMethod )(void *internalElement);
  255. EXTERN_API_C( TQ3XObjectClass )
  256. Q3XElementClass_Register        (TQ3ElementType *        elementType,
  257.                                  const char *            name,
  258.                                  unsigned long             sizeOfElement,
  259.                                  TQ3XMetaHandler         metaHandler);
  260.  
  261. EXTERN_API_C( TQ3Status )
  262. Q3XElementType_GetElementSize    (TQ3ElementType         elementType,
  263.                                  unsigned long *        sizeOfElement);
  264.  
  265.  
  266. /******************************************************************************
  267.  **                                                                             **
  268.  **                        Custom Attribute Registration                         **
  269.  **                                                                             **
  270.  *****************************************************************************/
  271. #define kQ3XMethodTypeAttributeInherit        Q3_METHOD_TYPE('i','n','h','t')
  272. typedef TQ3Boolean                         TQ3XAttributeInheritMethod;
  273. /* return kQ3True or kQ3False in your metahandler */
  274. #define kQ3XMethodTypeAttributeCopyInherit    Q3_METHOD_TYPE('a','c','p','i')
  275. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeCopyInheritMethod )(const void *fromInternalAttribute, void *toInternalAttribute);
  276. EXTERN_API_C( TQ3XObjectClass )
  277. Q3XAttributeClass_Register        (TQ3AttributeType *        attributeType,
  278.                                  const char *            creatorName,
  279.                                  unsigned long             sizeOfElement,
  280.                                  TQ3XMetaHandler         metaHandler);
  281.  
  282. /*
  283.  *    Version 1.5
  284.  */
  285. #define kQ3XMethodTypeAttributeDefault        Q3_METHOD_TYPE('a','s','d','f')
  286. typedef CALLBACK_API_C( TQ3Status , TQ3XAttributeDefaultMethod )(void *internalElement);
  287. #define kQ3XMethodTypeAttributeIsDefault        Q3_METHOD_TYPE('a','i','d','f')
  288. typedef CALLBACK_API_C( TQ3Boolean , TQ3XAttributeIsDefaultMethod )(void *internalElement);
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296. #if PRAGMA_ENUM_ALWAYSINT
  297.     #pragma enumsalwaysint reset
  298. #elif PRAGMA_ENUM_OPTIONS
  299.     #pragma option enum=reset
  300. #elif defined(PRAGMA_ENUM_PACK__QD3DSET__)
  301.     #pragma options(pack_enums)
  302. #endif
  303.  
  304. #if PRAGMA_STRUCT_ALIGN
  305.     #pragma options align=reset
  306. #elif PRAGMA_STRUCT_PACKPUSH
  307.     #pragma pack(pop)
  308. #elif PRAGMA_STRUCT_PACK
  309.     #pragma pack()
  310. #endif
  311.  
  312. #ifdef PRAGMA_IMPORT_OFF
  313. #pragma import off
  314. #elif PRAGMA_IMPORT
  315. #pragma import reset
  316. #endif
  317.  
  318. #ifdef __cplusplus
  319. }
  320. #endif
  321.  
  322. #endif /* __QD3DSET__ */
  323.  
  324.